import count from '@dfeidao/atom-nodejs/db/count';
import query from '@dfeidao/atom-nodejs/db/query';
// import { IBaseTable } from '@feidao/web/atom/nodejs/db/interfaces';


interface Message {
	filter: {};
	page_size: number;
	page_no: number;
}
// 查询数据(角色)
export default async function atom(msg: Message, action_id: string, session_id: string, spaceid: string) {
	const systemid = '12';
	const { exec, prepare } = query(action_id, session_id, systemid);

	prepare('pub_role', ['role_name', 'role_no', 'role_type_id', 'productid', 'icon', 'create_time'], msg.filter, 50, 1, [], []);
	const [data] = await exec();

	const c = count(action_id, session_id, systemid);
	c.prepare('pub_role', msg.filter);
	const [t] = await c.exec();

	return { dataArray: data, count: t };
}
